﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace MGI.Logica
{
    class MGIMail
    {
        
        
            static public void sendMail(string from, string to,string subject,string body,string smtp)
            {
                MailMessage msg = new MailMessage();
                msg.To.Add (new MailAddress(to));
                msg.From = new MailAddress(from);
                msg.Subject = subject;
                msg.Body = body;
                SmtpClient clienteSmtp = new SmtpClient(smtp);
                clienteSmtp.Send(msg);

                // Este es el código para autenticar
                /*
                clienteSmtp.Credentials =
                new NetworkCredential("usuario", "clave");

                 

                try

                {

                    clienteSmtp.Send(msg);

                }

                catch (Exception ex)

                {

                    Console.Write(ex.Message);

                    Console.ReadLine(); 

                }
                */
            }



            /*
            // create mail message object
            MailMessage mail = new MailMessage(;
            mail.From = new MailAddress("");           // put the from address here
            mail.To = new MailAddress("");             // put to address here
            mail.Subject = "";        // put subject here	
            mail.Body = "";           // put body of email here
            SmtpMail.SmtpServer = ""; // put smtp server you will use here 
            // and then send the mail
            SmtpMail.Send(mail);
            */
        }

}


